package com.lovo.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.lovo.dao.AllocateRequestMapper;
import com.lovo.vo.AllocateDetail;
import com.lovo.vo.Allocate_Record_Rollback;
import com.lovo.vo.Allocate_Request;
import com.lovo.vo.Allocate_Request_Rollback;
import com.lovo.vo.Allocate_record;
import com.lovo.vo.Goods;
import com.lovo.vo.Goods_Allocate_Track;


@Service
@Transactional
public class AllocateRequestService {
	@Autowired
	AllocateRequestMapper am;
	public 	List<Allocate_Request> findAllocateRequestByCondition(Allocate_Request allocate){
		
		return am.findAllocateRequestByCondition(allocate);
	}
	
	public int getCountFromAllocateRequest(Allocate_Request allocate){
		
		return am.getCountFromAllocateRequest(allocate);
	}
	
	public List<AllocateDetail> findByFromDept(AllocateDetail allocate){
		return am.findByFromDept(allocate);
	}
	
	public int insertAllocateRequest(Allocate_Request requ){
		return am.insertAllocateRequest(requ);
	}
	
	public int insertAllocateRecord(Allocate_record reco){
		return am.insertAllocateRecord(reco);
	}
	
	public Goods findGoodsById(String id){
		return am.findGoodsById(id);
	}
	
	public int insertGoods(Goods good){
		return am.insertGoods(good);
	}
	public int insertGoodsAllocateTrack(Goods_Allocate_Track gat){
		return am.insertGoodsAllocateTrack(gat);
	}
	
	public int updateAllocateRequestStatus(String[] ids){
		return am.updateAllocateRequestStatus(ids);
	}
	public int updateAllocateRecordStatus(String[] ids){
		return am.updateAllocateRecordStatus(ids);
	}
	public int updateGoodsAllocateTrackStatus(Goods_Allocate_Track gat){
	
		am.updateGoodsAllocateTrackInStatus(gat);
		int count=am.updateGoodsAllocateTrackOutStatus(gat);
		return count;
	}
	
	public int updateGoodsStatus(String requestid){
		am.updateGoodsInStatus(requestid);
		int count=am.updateGoodsOutStatus(requestid);
		return count;
	}
	public List<Allocate_record> findAllocateNum(String requestid){
		return am.findAllocateNum(requestid);
	}
	public int updateGoodsNum(Allocate_record record){
		return am.updateGoodsNum(record);
	}
	
	public int updateRefuseAllocateRequestStatus(String[] ids){
		return am.updateRefuseAllocateRequestStatus(ids);
	}
	
	public int deleteRefuseInfo(String requestid){
		 am.deleteGoods(requestid);
		 am.deleteGoodsAllocateTrack(requestid);	
		 return  am.deleteAllocateRecord(requestid);
	}
	
	public int insertAllocateRequestRollback(Allocate_Request_Rollback arr){
		return am.insertAllocateRequestRollback(arr);
	}
}
